/**
 * Description: RegisterLargeItemServiceImpl.java
 * Copyright (c) 2008-2009  Neo. 
 * All Rights Reserved.
 * @version 1.0  Apr 3, 2009 9:39:59 PM 李萌（neolimeng@gmail.com）created
 */
package org.paradise.dms.services.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.paradise.dms.dao.impl.RegisterLargeItemDAOImpl;
import org.paradise.dms.pojo.RegisterLargeItem;
import org.paradise.dms.services.RegisterLargeItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * Description: Copyright (c) 2008-2009 Neo. All Rights Reserved.
 * 
 * @version 1.0 Apr 3, 2009 9:39:59 PM 李萌（neolimeng@gmail.com）created
 */
@Service
public class RegisterLargeItemServiceImpl implements RegisterLargeItemService {
	private static Logger log = Logger
			.getLogger(RegisterLargeItemServiceImpl.class);
	@Autowired
	@Qualifier("registerLargeItemDAOImpl")
	private RegisterLargeItemDAOImpl registerLargeItemDAOImpl;
	List<RegisterLargeItem> lrli;
	RegisterLargeItem rli;

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.paradise.dms.services.RegisterLargeItemService#deleteRegisterLargeItem(int)
	 */
	public boolean deleteRegisterLargeItem(int rliid) {
		try {
			this.registerLargeItemDAOImpl.deleteRegisterLargeItem(rliid);
			log.info("DMS_info_根据登记ID删除大物品出入登记，成功！！登记ID值为：" + rliid);
			return true;
		} catch (Exception e) {
			log.error("DMS_error_根据登记ID删除大物品出入登记，失败！！登记ID值为：" + rliid);
			e.printStackTrace();
			return false;
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.paradise.dms.services.RegisterLargeItemService#getAllRegisterLargeItem()
	 */
	public List<RegisterLargeItem> getAllRegisterLargeItem() {
		try {
			lrli = this.registerLargeItemDAOImpl.getAllRegisterLargeItem();
			log.info("DMS_info_取得所有大物品登记信息，成功！！共有" + lrli.size() + "条信息。");
			return lrli;
		} catch (Exception e) {
			log.error("DMS_error_取得所有大物品登记信息，失败！！");
			e.printStackTrace();
			return null;
		}
	}

	public List<RegisterLargeItem> getAllRegisterLargeItemIn() {
		try {
			lrli = this.registerLargeItemDAOImpl.getAllRegisterLargeItemIn();
			log.info("DMS_info_取得所有大物品入登记信息，成功！！共有" + lrli.size() + "条信息。");
			return lrli;
		} catch (Exception e) {
			log.error("DMS_error_取得所有大物品入登记信息，失败！！");
			e.printStackTrace();
			return null;
		}
	}

	public int getAllRowsIn() {
		return this.registerLargeItemDAOImpl.getAllRowsIn();
	}

	public int getAllRowsOut() {
		return this.registerLargeItemDAOImpl.getAllRowsOut();
	}

	public List<RegisterLargeItem> listAllRegisterLargeItemIn(int pageSize,
			int startRow) {
		try {
			lrli = this.registerLargeItemDAOImpl.listAllRegisterLargeItemIn(
					pageSize, startRow);
			log.info("DMS_info_分页取得所有大物品入登记，成功！！本次读取" + pageSize + "条，起始条为第"
					+ startRow + "条");
			return lrli;
		} catch (Exception e) {
			log.error("DMS_error_分页读取所有大物品入登记，失败！！");
			return null;
		}

	}

	public List<RegisterLargeItem> listAllRegisterLargeItemOut(int pageSize,
			int startRow) {
		try {
			lrli = this.registerLargeItemDAOImpl.listAllRegisterLargeItemOut(
					pageSize, startRow);
			log.info("DMS_info_分页取得所有大物品出登记，成功！！本次读取" + pageSize + "条，起始条为第"
					+ startRow + "条");
			return lrli;
		} catch (Exception e) {
			log.error("DMS_error_分页读取所有大物品出登记，失败！！");
			return null;
		}
	}

	public List<RegisterLargeItem> getAllRegisterLargeItemOut() {
		try {
			lrli = this.registerLargeItemDAOImpl.getAllRegisterLargeItemOut();
			log.info("DMS_info_取得所有大物品出登记信息，成功！！共有" + lrli.size() + "条信息。");
			return lrli;
		} catch (Exception e) {
			log.error("DMS_error_取得所有大物品出登记信息，失败！！");
			e.printStackTrace();
			return null;
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.paradise.dms.services.RegisterLargeItemService#getRegisterLargeItem(int)
	 */
	public RegisterLargeItem getRegisterLargeItem(int rliid) {
		try {
			rli = this.registerLargeItemDAOImpl.getRegisterLargeItem(rliid);
			log.info("DMS_info_根据ID取得大物品登记信息，成功！！ID值为：" + rliid);
			return rli;
		} catch (Exception e) {
			log.error("DMS_error_根据ID取得大物品登记信息，失败！！ID值为：" + rliid);
			e.printStackTrace();
			return null;
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.paradise.dms.services.RegisterLargeItemService#insertRegisterLargeItem(org.paradise.dms.pojo.RegisterLargeItem)
	 */
	public boolean insertRegisterLargeItem(RegisterLargeItem rli) {
		try {
			this.registerLargeItemDAOImpl.insertRegisterLargeItem(rli);
			log.info("DMS_info_插入大物品登记信息，成功！！学生信息："
					+ rli.getStudentno()
					+ " 类型："
					+ rli.getRegisterlargeitemtype()
							.getRegisterlargeitemtypeid());
			return true;
		} catch (Exception e) {
			log.error("DMS_error_插入大物品登记信息，失败！！");
			e.printStackTrace();
			return false;
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.paradise.dms.services.RegisterLargeItemService#updateRegisterLargeItem(org.paradise.dms.pojo.RegisterLargeItem)
	 */
	public boolean updateRegisterLargeItem(RegisterLargeItem rli) {
		try {
			this.registerLargeItemDAOImpl.updateRegisterLargeItem(rli);
			log.info("DMS_info_更新大物品登记信息，成功！！ID值为："
					+ rli.getRegisterlargeitemid());
			return true;
		} catch (Exception e) {
			log.error("DMS_error_更新大物品登记信息，失败！！ID值为："
					+ rli.getRegisterlargeitemid());
			e.printStackTrace();
			return false;
		}
	}

	public boolean setRegisterLargeItemInToOut(int rliid) {
		try {
			this.registerLargeItemDAOImpl.setRegisterLargeItemInToOut(rliid);
			log.info("DMS_info_设置大物品出楼，成功！！ID值为：" + rliid);
			return true;
		} catch (Exception e) {
			log.error("DMS_error_设置大物品出楼，失败！！ID值为：" + rliid);
			e.printStackTrace();
			return false;
		}
	}

	public boolean setRegisterLargeItemOutToIn(int rliid) {
		try {
			this.registerLargeItemDAOImpl.setRegisterLargeItemOutToIn(rliid);
			log.info("DMS_info_设置大物品入楼，成功！！ID值为：" + rliid);
			return true;
		} catch (Exception e) {
			log.error("DMS_error_设置大物品入楼，失败！！ID值为：" + rliid);
			e.printStackTrace();
			return false;
		}
	}

	/**
	 * @return the registerLargeItemDAOImpl
	 */
	public RegisterLargeItemDAOImpl getRegisterLargeItemDAOImpl() {
		return registerLargeItemDAOImpl;
	}

	/**
	 * @param registerLargeItemDAOImpl
	 *            the registerLargeItemDAOImpl to set
	 */
	public void setRegisterLargeItemDAOImpl(
			RegisterLargeItemDAOImpl registerLargeItemDAOImpl) {
		this.registerLargeItemDAOImpl = registerLargeItemDAOImpl;
	}

	public List<RegisterLargeItem> getLrli() {
		return lrli;
	}

	public void setLrli(List<RegisterLargeItem> lrli) {
		this.lrli = lrli;
	}

	public RegisterLargeItem getRli() {
		return rli;
	}

	public void setRli(RegisterLargeItem rli) {
		this.rli = rli;
	}
}
